// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

using Elastic.Transport;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable restore
namespace Elastic.Clients.Elasticsearch.Ml
{
	public sealed class MlRevertModelSnapshotRequestParameters : RequestParameters<MlRevertModelSnapshotRequestParameters>
	{
	}

	public sealed partial class MlRevertModelSnapshotRequest : PlainRequestBase<MlRevertModelSnapshotRequestParameters>
	{
		public MlRevertModelSnapshotRequest(Elastic.Clients.Elasticsearch.Id job_id, Elastic.Clients.Elasticsearch.Id snapshot_id) : base(r => r.Required("job_id", job_id).Required("snapshot_id", snapshot_id))
		{
		}

		internal override ApiUrls ApiUrls => ApiUrlsLookups.MachineLearningRevertModelSnapshot;
		protected override HttpMethod HttpMethod => HttpMethod.POST;
		protected override bool SupportsBody => true;
		[JsonInclude]
		[JsonPropertyName("delete_intervening_results")]
		public bool? DeleteInterveningResults { get; set; }
	}

	public sealed partial class MlRevertModelSnapshotRequestDescriptor : RequestDescriptorBase<MlRevertModelSnapshotRequestDescriptor, MlRevertModelSnapshotRequestParameters>
	{
		internal MlRevertModelSnapshotRequestDescriptor(Action<MlRevertModelSnapshotRequestDescriptor> configure) => configure.Invoke(this);
		public MlRevertModelSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.Id job_id, Elastic.Clients.Elasticsearch.Id snapshot_id) : base(r => r.Required("job_id", job_id).Required("snapshot_id", snapshot_id))
		{
		}

		internal MlRevertModelSnapshotRequestDescriptor()
		{
		}

		internal override ApiUrls ApiUrls => ApiUrlsLookups.MachineLearningRevertModelSnapshot;
		protected override HttpMethod HttpMethod => HttpMethod.POST;
		protected override bool SupportsBody => true;
		public MlRevertModelSnapshotRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id job_id)
		{
			RouteValues.Required("job_id", job_id);
			return Self;
		}

		public MlRevertModelSnapshotRequestDescriptor SnapshotId(Elastic.Clients.Elasticsearch.Id snapshot_id)
		{
			RouteValues.Required("snapshot_id", snapshot_id);
			return Self;
		}

		private bool? DeleteInterveningResultsValue { get; set; }

		public MlRevertModelSnapshotRequestDescriptor DeleteInterveningResults(bool? deleteInterveningResults = true)
		{
			DeleteInterveningResultsValue = deleteInterveningResults;
			return Self;
		}

		protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
		{
			writer.WriteStartObject();
			if (DeleteInterveningResultsValue.HasValue)
			{
				writer.WritePropertyName("delete_intervening_results");
				writer.WriteBooleanValue(DeleteInterveningResultsValue.Value);
			}

			writer.WriteEndObject();
		}
	}
}